package com.aaa.dao;


import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;
import java.util.Map;

public interface T_CommentDao {
    @Select("<script>select * from appraisal_items " +
            "where 1=1 <if test=\"id!=null and id!=0\">  and id = #{id}</if>"
            +" <if test=\"pname!=null and pname!=''\"> and pname like concat('%',#{pname},'%')</if>" +
            "limit #{start},#{pageSize}</script>")
         List<Map> SelectAll(Map map);
    @Select("<script>select count(id) from appraisal_items" +
            " where 1=1 <if test=\"id!=null and id!=0\"> and id = #{id}</if>" +
            " <if test=\"pname!=null and pname!=''\"> and pname like concat('%',#{pname},'%')</if> </script>")
         Integer getCount(Map map);

    @Insert("insert into appraisal_items(pname,excellent,good,secondary,poor,content)" +
            "values(#{pname},#{excellent},#{good},#{secondary},#{poor},#{content})")
    public Integer Insert(Map map);
   @Update("update appraisal_items set state=2 where id=#{id}")
    public Integer Del(Map map);
    @Update("update appraisal_items set pname=#{pname},excellent=#{excellent},good=#{good}" +
            ",secondary=#{secondary},poor=#{poor},content=#{content} where id=#{id}")
    public Integer Update(Map map);
    @Update("update appraisal_items set state=1 where id=#{id}")
    Integer open(Integer id);
}
